package com.zego.wawaji.ui.center.pay.bean;

import android.os.Parcel;
import android.os.Parcelable;

import com.zego.wawaji.base.data.BaseData;

import org.json.JSONObject;

/**
 * 充值记录
 * Created by Su on 2017/12/1.
 */
public class OrderRecord extends BaseData implements Parcelable {
    private int payType;  // 充值类型  1:微信 2:支付宝 3:娃娃兑换 4:积分兑换 5 邀请奖励 6 签到奖励  7 扣币补偿
    private String remark;  // 说明
    private int wwCoinCz;   // 充值
    private int wwCoinZs;   // 赠送
    private String createTime;  // 记录时间
    private int payStatus;   // 支付状 -3：未支付 -2：支付发生错误 -1：支付已取消 1：支付成功

    @Override
    public void parseJson(String jsonStr) {
        JSONObject jsonObject = getJsonObject(jsonStr);
        this.setPayType(jsonObject.optInt("PayType"));
        this.setRemark(jsonObject.optString("Subject"));
        this.setWwCoinCz(jsonObject.optInt("WwCoinCz"));
        this.setWwCoinZs(jsonObject.optInt("WwCoinZs"));
        this.setCreateTime(jsonObject.optString("CreateTime"));
        this.setPayStatus(jsonObject.optInt("PayStatus"));
    }

    public int getPayStatus() {
        return payStatus;
    }

    public void setPayStatus(int payStatus) {
        this.payStatus = payStatus;
    }

    public String getCreateTime() {
        return createTime;
    }

    public void setCreateTime(String createTime) {
        this.createTime = createTime;
    }

    public int getPayType() {
        return payType;
    }

    public void setPayType(int payType) {
        this.payType = payType;
    }

    public String getRemark() {
        return remark;
    }

    public void setRemark(String remark) {
        this.remark = remark;
    }

    public int getWwCoinCz() {
        return wwCoinCz;
    }

    public void setWwCoinCz(int wwCoinCz) {
        this.wwCoinCz = wwCoinCz;
    }

    public int getWwCoinZs() {
        return wwCoinZs;
    }

    public void setWwCoinZs(int wwCoinZs) {
        this.wwCoinZs = wwCoinZs;
    }

    public OrderRecord() {
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeInt(this.payType);
        dest.writeString(this.remark);
        dest.writeInt(this.wwCoinCz);
        dest.writeInt(this.wwCoinZs);
        dest.writeString(this.createTime);
        dest.writeInt(this.payStatus);
    }

    protected OrderRecord(Parcel in) {
        this.payType = in.readInt();
        this.remark = in.readString();
        this.wwCoinCz = in.readInt();
        this.wwCoinZs = in.readInt();
        this.createTime = in.readString();
        this.payStatus = in.readInt();
    }

    public static final Creator<OrderRecord> CREATOR = new Creator<OrderRecord>() {
        @Override
        public OrderRecord createFromParcel(Parcel source) {
            return new OrderRecord(source);
        }

        @Override
        public OrderRecord[] newArray(int size) {
            return new OrderRecord[size];
        }
    };
}
